﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using BeautyTech.Data;
using BeautyTech.Data.DbInitializer;
using BeautyTech.Core.Domain.Blogs;
using BeautyTech.Core.Domain.Catalogs;

namespace BeautyTech.XConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            var context = new DataContext();
            var dataBaseInitializer = new DataBaseInitializer();
            dataBaseInitializer.InitializeDatabase(context);

            
            #region Categorie
            /*
            var categoryRepository = new Repository<Category>(context);
            //Adding category in the category entity
            var categories = new List<Category>();

            Console.WriteLine("-> Top catégories");
            categories.Add(new Category { Name = "Epilation", SeName = "epilation", ParentId = 0, CatalogId = 1, Order = 1 });
            categories.Add(new Category { Name = "Jetable & Hygiène", SeName = "jetable-hygiene", ParentId = 0, CatalogId = 1, Order = 2 });
            categories.Add(new Category { Name = "Manucure", SeName = "manucure", ParentId = 0, CatalogId = 1, Order = 3 });
            categories.Add(new Category { Name = "Beauté du visage", SeName = "beaute-du-visage", ParentId = 0, CatalogId = 1, Order = 4 });
            categories.Add(new Category { Name = "Soins Instituts & SPA", SeName = "soins-institut-spa", ParentId = 0, CatalogId = 1, Order = 5 });
            categories.Add(new Category { Name = "Matériel SPA", SeName = "materiel-spa", ParentId = 0, CatalogId = 1, Order = 6 });
            categories.Add(new Category { Name = "Technologie", SeName = "technologie", ParentId = 0, CatalogId = 1, Order = 7 });
            categories.Add(new Category { Name = "Mobilier", SeName = "mobilier", ParentId = 0, CatalogId = 1, Order = 8 });
            categories.Add(new Category { Name = "Bronzage", SeName = "bronzage", ParentId = 0, CatalogId = 1, Order = 9 });

            Console.WriteLine("-> Epilation niveau 1");
            categories.Add(new Category { Name = "Epilation à la cire", SeName = "epilation-cire", ParentId = 1, CatalogId = 1, Order = 1 });
            categories.Add(new Category { Name = "Lotions et Soins Epilatoires", SeName = "lotions-soins-epilatoires", ParentId = 1, CatalogId = 1, Order = 2 });
            categories.Add(new Category { Name = "Appareils Epilation", SeName = "appareils-epilation", ParentId = 1, CatalogId = 1, Order = 3 });
            categories.Add(new Category { Name = "Bandes & Accessoires", SeName = "bandes-accessoires", ParentId = 1, CatalogId = 1, Order = 4 });
            categories.Add(new Category { Name = "Kits et Packs PROMO Epilation", SeName = "kits-packs-promo-epilation", ParentId = 1, CatalogId = 1, Order = 5 });
            categories.Add(new Category { Name = "Accessoires pour Lumière Pulsée", SeName = "accessoires-lumiere-pulsee", ParentId = 1, CatalogId = 1, Order = 6 });

            Console.WriteLine("-> Hygiene et jetable niveau 1");
            categories.Add(new Category { Name = "Linge Jetable", SeName = "linge-jetable", ParentId = 2, CatalogId = 1, Order = 1 });
            categories.Add(new Category { Name = "Hygiène & Désinfection", SeName = "hygiene-desinfection", ParentId = 2, CatalogId = 1, Order = 2 });
            categories.Add(new Category { Name = "Accessoires", SeName = "accessoires", ParentId = 2, CatalogId = 1, Order = 3 });
            categories.Add(new Category { Name = "Linge cabine", SeName = "linge-cabine", ParentId = 2, CatalogId = 1, Order = 4 });
            categories.Add(new Category { Name = "Lunettes & Accessoires UV", SeName = "lunettes-accessoires-uv", ParentId = 2, CatalogId = 1, Order = 5 });
            categories.Add(new Category { Name = "Vêtements professionnels", SeName = "vetements-professionnels", ParentId = 2, CatalogId = 1, Order = 6 });

            Console.WriteLine("-> Manucure niveau 1");
            categories.Add(new Category { Name = "ESSIE, l'obsession de la couleur !", SeName = "essie", ParentId = 3, CatalogId = 1, Order = 1 });
            categories.Add(new Category { Name = "Ligne Wunder Nails", SeName = "ligne-wunder-nails", ParentId = 3, CatalogId = 1, Order = 2 });
            categories.Add(new Category { Name = "Soins Mains / Pieds", SeName = "soins-mains-pieds", ParentId = 3, CatalogId = 1, Order = 3 });
            categories.Add(new Category { Name = "Appareils et accessoires", SeName = "appareils et accessoires", ParentId = 3, CatalogId = 1, Order = 4 });
            categories.Add(new Category { Name = "Tables Manucure", SeName = "tables-manucure", ParentId = 3, CatalogId = 1, Order = 5 });
            categories.Add(new Category { Name = "Appareils et Fauteuils Pédicure", SeName = "appareils-fauteuils-pedicure", ParentId = 3, CatalogId = 1, Order = 6 });
            categories.Add(new Category { Name = "Ligne LCN", SeName = "ligne-lcn", ParentId = 3, CatalogId = 1, Order = 7 });
            categories.Add(new Category { Name = "Ligne Crisnail", SeName = "ligne-crisnail", ParentId = 3, CatalogId = 1, Order = 8 });

            Console.WriteLine("Ajout des données");
            foreach (Category c in categories)
            {
                categoryRepository.Insert(c);
            }
            context.SaveChanges();
            */
            #endregion
            
            #region Blogs
            Console.WriteLine("Ajout de blogs");
            var blogRepository = new Repository<BlogPost>(context);
            var blogPosts = new List<BlogPost>();

            blogPosts.Add(new BlogPost
            {
                Title = "SOS Coups de soleil",
                Introduction = "Week-end de grand soleil sur la France. Dégâts à constater : excès de smoothies, de glaces, d’apéros en terrasse… et de coups de soleil. Pas de panique, voici nos prescriptions pour que le look écrevisse ne soit qu’un mirage. Le coup de soleil sur le corps : le plus fréquent et le plus douloureux. La solution ? Hydrater jusqu’à plus [...]",
                Body = "<strong>Le coup de soleil sur le corps : le plus fréquent et le plus douloureux.</strong> La solution ? Hydrater jusqu’à plus soif, enfin jusqu’à ce que votre peau ait bu la crème. C’est d’ailleurs l’indicateur pour savoir si vous devez en mettre à nouveau. Répétez la routine hydratation plusieurs fois par jour et le soir, faîtes des cataplasmes de crème pour soulager d’abord et régénérer ensuite, votre peau agressée par le soleil.",
                CreatedOn = DateTime.Parse("2013-07-09")
            });
            Console.WriteLine("Ajout des données");
            foreach (BlogPost bp in blogPosts)
            {
                blogRepository.Insert(bp);
            }
            context.SaveChanges();

            for (int i = 0; i <= 200; i++)
            {
                blogRepository.Insert(new BlogPost
                {
                    Title = "Blog post num " + i,
                    Introduction = "ceci est l'intro du blog post " + i,
                    Body = "olalalal dsqdsqdqs laeazlezal dqs qsdqs dqsd za az eazedsq ddsqdqs",
                    CreatedOn = DateTime.Parse("2013-07-26")
                });
                Console.WriteLine("Ajout du blog " + i);
            }
            context.SaveChanges();

            #endregion

            #region Catalog
            Console.WriteLine("Ajout du catalogue");
            var catalogRepository = new Repository<Catalog>(context);
            var catalog = new Catalog();
            catalog.Name = "Catalogue Général";

            catalogRepository.Insert(catalog);
            context.SaveChanges();

            #endregion


            Console.WriteLine("Opération terminée");
            Console.ReadLine();

           
        }
    }
}
